package com.zhai.domain.award.model.aggregate;

import com.zhai.domain.award.model.entity.UserAwardRecordEntity;
import com.zhai.domain.award.model.entity.UserCreditAwardEntity;
import com.zhai.domain.award.model.valobj.AwardStateVO;
import lombok.AllArgsConstructor;
import lombok.Builder;
import lombok.Data;
import lombok.NoArgsConstructor;

import java.math.BigDecimal;

/**
 * @Description: 发奖服务聚合类
 * @ClassName: GiveOutPrizesAggregate
 * @Author: zhaiyongxin
 * @Date: 2025/6/23 13:16
 * @Version: 1.0
 */
@Data
@Builder
@AllArgsConstructor
@NoArgsConstructor
public class GiveOutPrizesAggregate {
    /**
     * 用户id
     */
    private String userId;
    /**
     * 奖品对象
     */
    private UserAwardRecordEntity userAwardRecord;
    /**
     *用户积分奖励
     */
    private UserCreditAwardEntity userCreditAward;

    public static UserAwardRecordEntity buildUserAwardRecordEntity(String userId, String orderId, Integer awardId, AwardStateVO awardState) {
        return UserAwardRecordEntity.builder()
                .userId(userId)
                .orderId(orderId)
                .awardId(awardId)
                .awardState(awardState)
                .build();
    }

    public static UserCreditAwardEntity buildUserCreditAwardEntity(String userId, BigDecimal creditAmount) {
        return UserCreditAwardEntity.builder()
                .userId(userId)
                .creditAmount(creditAmount)
                .build();
    }
}
